<script setup name="worksNaming">
import { ref } from "vue";
import { showToast } from "vant";
import { useRouter } from "vue-router";
import { useMyStore } from "../store/index";
const router = useRouter();
const customArtwork = useMyStore();
// let tips = ref("请输入作品名称,最多8个字");
let workName = ref("");
const toAdd = () => {
  if (workName.value === "") {
    showToast("请填写作品名称");
  } else {
    customArtwork.pageName = workName.value;
    console.log(pageContent);
    router.push("/works/add");
  }
};
</script>
<template>
  <!-- 起名页面 -->
  <div class="bg">
    <div>
      <p class="title">每个作品都是一份真诚的心意</p>
      <p class="title">请为您优秀的作品命个名吧</p>
    </div>
  </div>
  <div class="work_name">
    <input
      type="text"
      v-model="workName"
      maxLength="8"
      placeholder="遇见美好～"
    />
    <p>请填写作品名称,最多8个字</p>
  </div>
  <img class="submit" @click="toAdd" src="../assets/skinSecond.png" alt="" />
</template>

<style lang="less" scoped>
.title {
  padding: 0;
  margin: 0;
}

.bg {
  width: (100% - 10px);
  height: 550px;
  margin-left: 30px;
  background-image: url("@/assets/background-name.png");
  background-repeat: no-repeat;
  background-size: cover;

  div {
    font-size: 34px;
    font-family: PingFang-SC-Regular, PingFang-SC;
    font-weight: 400;
    color: #333333;
    line-height: 48px;
    margin-top: 387px;
  }
}

.work_name {
  input {
    margin-left: 24px;
    outline: none;
    width: 702px;
    height: 90px;
    background: #f8f8f8;
    border-radius: 16px;
    border: 1px solid hsl(0, 74%, 82%);
    padding-left: 30px;
    font-size: 34px;
    box-sizing: border-box;
  }

  input:focus {
    border: 1px solid #ff6464;
  }

  p {
    font-size: 26px;
    font-family: PingFang-SC-Regular, PingFang-SC;
    font-weight: 400;
    color: #666;
    margin-left: 30px;
    margin-top: 10px;
  }
}

.submit {
  display: block;
  width: 690px;
  height: 90px;
  margin-left: 30px;
  position: fixed;
  bottom: 100px;
}
</style>
